var rowSeparator = '/%/|%|';
var http = require("http");
var url = require("url");

var CallbackManager = require('./CallbackManager.js');
var callbackManager = new CallbackManager();

//Get the environment variables we need.
var ipaddr ="127.0.0.1";
var port =  5050;


http.createServer(function (request, response) {
	try {
		var params = url.parse(request.url.toLowerCase(), true).query;
		console.log('QueryString: ' + JSON.stringify(params));
		callbackManager.execute(response, params);
	} catch (err) {
		response.end(rowSeparator);
	}
}).listen(port);


//console.log("Server Running...");